alert('SceneMapQueebnsPark.js loaded');
var NbMapQueensParkButtons = 3; // Nbre de boutons
var VideoYoutubeOnce= true;
function SceneMapQueensPark() {

};

SceneMapQueensPark.prototype.initialize = function () {
	alert("SceneMapQueensPark.initialize()");
	// this function will be called only once when the scene manager show this scene first time
	// initialize the scene controls and styles, and initialize your variables here
	// scene HTML and CSS will be loaded before this function is called
	
	sf.scene.show('ToolBar');
	
	$('#Dot').sfImage({
		src:'images/press-1.png'
	});
	
	$('#Dot2').sfImage({
		src:'images/press-2.png'
	});
	
	$('#Dot3').sfImage({
		src:'images/press-3.png'
	});
	

	$('#El01').css("left",ExtractX(1,5)+"px");
	$('#El01').css("top",ExtractY(1,5)+"px");
	
	$('#El02').css("left",ExtractX(4,8)+"px");
	$('#El02').css("top",ExtractY(4,8)+"px");

	$('#El03').css("left",ExtractX(5,4)+"px");
	$('#El03').css("top",ExtractY(3,4)+"px");

	
	alert(" **** " + $('#El01').css("left") + " **** ");
	alert(" **** " + $('#El02').css("left") + " **** ");
	alert(" **** " + $('#El02').css("left") + " **** ");

};

SceneMapQueensPark.prototype.handleShow = function (data) {
	alert("SceneMapQueensPark.handleShow()");
	// this function will be called when the scene manager show this scene //Cause of the name not like the other scenes	
	/*
	if(VideoYoutubeOnce){
		StartingplayerScene(CurrentScene);
		VideoYoutubeOnce= false;
	}*/
	IdScene ="1";
	CurrentScene = "MapQueensPark";
	SelectIcon = false; // Si egale a False on cacher les icones de choix de scene

	SceneReset("MapQueensPark",-1);
	//scene="MapQueensPark/1-a.json";
	alert(' MapDialogue name: Avant verification'+scene);
	if(MapDialogue != false){
		alert("llllllllllllllllllllllllllllllllllllll");
		scene = MapDialogue;
		alert(' MapDialogue name: '+scene);
		alert('SelectIcon '+SelectIcon);
	}
	if(SelectIcon == true)  $('.IconMap').fadeIn('slow');
	
	
};

SceneMapQueensPark.prototype.handleHide = function () {
	alert("SceneMapQueensPark.handleHide()");
	// this function will be called when the scene manager hide this scene
	scene="";
};

SceneMapQueensPark.prototype.handleFocus = function () {
	alert("SceneMapQueensPark.handleFocus()");
	// this function will be called when the scene manager focus this scene
};

SceneMapQueensPark.prototype.handleBlur = function () {
	alert("SceneMapQueensPark.handleBlur()");
	// this function will be called when the scene manager move focus to another scene from this scene
};

SceneMapQueensPark.prototype.handleKeyDown = function (keyCode) {
	alert("SceneMapQueensPark.handleKeyDown(" + keyCode + ")");
	// TODO : write an key event handler when this scene get focued
	switch (keyCode) {
		case sf.key.LEFT:
			if(SelectIcon == true){
				/*PosDialButton--;
				if(PosDialButton<0) PosDialButton=1;
				if(PosDialButton/2 == Math.round(PosDialButton/2)){  
				$('#Dot2').sfImage({src:'images/Dot.png'});
				$('#Dot').sfImage({src:'images/Dot2.png'});
				PosDialButton=0;
				}else {
					$('#Dot').sfImage({src:'images/Dot.png'});
					$('#Dot2').sfImage({src:'images/Dot2.png'});	
					PosDialButton=1;
				}*/
			}
			break;
			
		case sf.key.RIGHT:

			if(SelectIcon == true){
				/*
				PosDialButton--;
				if(PosDialButton>1) PosDialButton=0;
				if(PosDialButton/2 == Math.round(PosDialButton/2)){  
				$('#Dot2').sfImage({src:'images/Dot.png'});
				$('#Dot').sfImage({src:'images/Dot2.png'});
				PosDialButton=0;
				}else {
					$('#Dot').sfImage({src:'images/Dot.png'});
					$('#Dot2').sfImage({src:'images/Dot2.png'});	
					PosDialButton=1;	
				}
				*/
			}
			
			break;
		case sf.key.UP:
			break;
		case sf.key.DOWN:
			break;
		case sf.key.ENTER:
			alert("-----------------------------------------");
			alert(' SelectIcon = '+SelectIcon);
			alert("-----------------------------------------");
			if (SelectIcon != true){
				OneTime();			
			}

			break;
		case sf.key.N1:
			alert("//// SelectIcon : "+SelectIcon);
			if (SelectIcon == true){
				HideSelectIcon();
				sf.scene.hide('MapQueensPark');
				sf.scene.show('Scene2');
				sf.scene.focus('Scene2');
			}
			break;
		case sf.key.N2:
			alert("//// SelectIcon : "+SelectIcon);
			if (SelectIcon == true){
				HideSelectIcon();
				sf.scene.hide('MapQueensPark');
				sf.scene.show('Scene3');
				sf.scene.focus('Scene3');
			}
			break;
		case sf.key.N3:
			alert("//// SelectIcon : "+SelectIcon);
			if (SelectIcon == true){
				HideSelectIcon();
				sf.scene.hide('MapQueensPark');
				sf.scene.show('Scene4');
				sf.scene.focus('Scene4');
			}
			break;
		case sf.key.RETURN:
			HideSelectIcon();
			event.preventDefault();
			sf.scene.hide('MapQueensPark');
			sf.scene.show('Scene1');
			sf.scene.focus('Scene1');
			break;
			

		default:
			alert("handle default key event, key code(" + keyCode + ")");
			break;
	}
};

function HandleSelect(){
/*	if (PosDialButton == 0){
		$('#Dot').sfImage({src:'images/Dot2.png'});
		$('#Dot2').sfImage({src:'images/Dot.png'});				
	}else if (PosDialButton == 1){
		$('#Dot').sfImage({src:'images/Dot.png'});
		$('#Dot2').sfImage({src:'images/Dot2.png'});				
	}
*/
	alert('*--*-*-*-*-*   ButtonsMapQueensPark ' + PosDialButton);

	if(PosDialButton == -1) PosDialButton=1; else if(PosDialButton == NbButton )PosDialButton = 0;
	alert('*--*-*-*-*-*   ButtonsMapQueensPark After Verification ' + PosDialButton);
	
		if (PosDialButton == 0){
			alert('1');
			$('#Dot').sfImage({src:'images/Dot.png'});
			$('#Dot2').sfImage({src:'images/Dot2.png'});
		
		
		}else if (PosDialButton == 1){
			alert('2');

		$('#Dot').sfImage({src:'images/Dot.png'});
		$('#Dot2').sfImage({src:'images/Dot2.png'});
		

		}
		alert('*--*-*-*-*-*    NbMapQueensParkButtons -> ' + NbButton);
		alert('*--*-*-*-*-*     ButtonsMapQueensParkFINISH -> ' + PosDialButton);
}

